Repository navigation
Stabilize the game, add tests and rewrite the README - #10
Merged
Merged
Conversation
Extract the damage and healing math into pure functions that accept an injectable random function. Behavior is unchanged.
Resolve a whole round inside a single Agent operation. This prevents interleaved moves, out of turn moves and changes after game over. Game.update/1 is removed, and the damage reported is the damage applied.
make_move/1 now returns an error tuple for rejected moves, and each round prints a readable summary instead of the internal state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the bugs that broke the game outside the happy path, covers the rules with tests, and documents how to install and play it. The game mechanics are unchanged.
Bugs fixed
Improvements
@moduledoc,@doc,@specand doctests.lib/ex_mon/layout.credo.exs), and Dialyzer was added.main.Breaking changes
make_move/1returns{:error, reason}for rejected moves.create_player/4rejects non-string player names and invalid or duplicated move names.Game.update/1and the other internal state helpers were removed.Testing
Run locally on Debian 13:
mix compile --warnings-as-errors,mix format --check-formatted,mix credo --strict,mix dialyzermix test --cover: 61 tests, 100% coverageNot tested: the installation steps on macOS, Ubuntu, Fedora and Arch.